<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=utf-8">
	<TITLE></TITLE>
	<META NAME="GENERATOR" CONTENT="OpenOffice.org 2.0  (Linux)">
	<META NAME="AUTHOR" CONTENT="kejin">
	<META NAME="CREATED" CONTENT="20070529;10350290">
	<META NAME="CHANGEDBY" CONTENT="kejin">
	<META NAME="CHANGED" CONTENT="20070529;1332200">
	<STYLE TYPE="text/css">
	<!--
		@page { size: 8.5in 11in; margin: 0.79in }
		P { margin-bottom: 0.08in }
		H2 { color: #000000 }
		H3 { color: #000000 }
		PRE { color: #000000 }
	-->
	</STYLE>
</HEAD>
<BODY LANG="en-US" DIR="LTR">
<H2>PocoCapsule/C++ basic-IoC DSM example: Software Defined Radio
(SDR) in DSM</H2>
<P>Copyright(c) 2006 by <A HREF="http://www.pocomatic.com/">Pocomatic
Software</A>. All rights reserved.</P>
<P>This example illustrates a Software Defined Radio (SDR) waveform
application deployed in a domain-specific-modeling (DSM) schema. The original example can be
found in the <A HREF="http://www.crc.ca/scari/">CRC's reference
implementation</A> of the <A HREF="http://jtrs.spawar.navy.mil/sca/">JTRS-SCA</A>.
</P>
<P><I>Note: A JTRS-SCA compliant CORBA based version of this example
can be found in the <A HREF="../../corba/jtrs-sca/README.html">${POCOCAPSULE_DIR}/examples/corba/jtrs-sca</A>
directory. However, The non-CORBA version of the same SDR waveform
application presented here is more straightforward and significantly
slim than its CORBA counterpart. Therefore, when all components of a
waveform application are inside a same addressing space, this
non-CORBA approach is a much better alternative.</I></P>
<P>The modeled SDR waveform application consists of the following
eight components:</P>
<UL>
	<LI><P><FONT SIZE=2>An AudioDevice: the node1-audio-device bean </FONT>
	</P>
	<LI><P><FONT SIZE=2>An AudioEchoResource: the echo-resource bean</FONT></P>
	<LI><P><FONT SIZE=2>An AudioChorusResource: the chorus-resource bean</FONT></P>
	<LI><P><FONT SIZE=2>An AudioEffectController: the
	audio-effect-controller bean</FONT></P>
	<LI><P><FONT SIZE=2>A ModulationFMResource: the
	modulation-FM-resource bean</FONT></P>
	<LI><P><FONT SIZE=2>A DemodulationFMResource: the
	demodulation-FM-resource bean</FONT></P>
	<LI><P><FONT SIZE=2>A FMTransmitterReceiverAssemblyController: the
	FM-transmitter-receiver-assembly-controller bean</FONT></P>
	<LI><P><FONT SIZE=2>A LogImpl: the log bean</FONT></P>
</UL>
<P>These components are implemented as plain old C++ objects (POCOs)
and are instantiated and wired up using the PocoCapsule/C++ IoC
Container according to the <A HREF="setup.xml">setup.xml</A>
description. The assembled SDR waveform application is illustrated in
the following diagram: 
</P>
<H3><A HREF="sdr.jpg"><IMG SRC="sdr.jpg" NAME="SDR.JPG" ALIGN=LEFT WIDTH=558 HEIGHT=417 BORDER=0><BR CLEAR=LEFT></A>Source
Files</H3>
<P><A HREF="main.C">main.C:</A> This is a mini container, used by
PocoCapsule/C++ to assemble/deploy this SDR waveform. <I><FONT COLOR="#000000">This
container is completely application logic independent. It contains no
application specific code. Its executable, after build, does not
depend on (by linking to) any application specific component modules
(dynamic libraries).</FONT></I></P>
<P><A HREF="AudioEffect.h">AudioEffect.h</A> and <A HREF="AudioEffect.C">AudioEffect.C:</A>
&quot;Business logic&quot; implementations of the following
components in plain old C++ object classes:</P>
<UL>
	<LI><P><FONT SIZE=2>AudioDevice, </FONT>
	</P>
	<LI><P><FONT SIZE=2>AudioEchoResource</FONT></P>
	<LI><P><FONT SIZE=2>AudioChorusResource.</FONT></P>
	<LI><P><FONT SIZE=2>AudioEffectController </FONT>
	</P>
</UL>
<P STYLE="font-weight: medium"><FONT COLOR="#000000"><FONT SIZE=3><I>These
application logic implementations are completely framework (i.e.
PocoCapsule/C++) independent. They contain no PocoCapsule/C++
specific code. It binary module (dynamic library), after build, does
not depend on (by linking to) PocoCapsule/C++ runtime either.</I></FONT></FONT></P>
<P><A HREF="FMTransmitterReceiver.h">FMTransmitterReciver.h</A> and
<A HREF="FMTransmitterReceiver.C">FMTransmitterReciver.C:</A> These
files provides application logic implementations of the following
components in plain old C++ object classes: 
</P>
<UL>
	<LI><P><FONT SIZE=2>DemodulationFMResource</FONT></P>
	<LI><P><FONT SIZE=2>ModulationFMResource</FONT></P>
	<LI><P><FONT SIZE=2>FMTransmitterReceiverAssemblyController</FONT></P>
</UL>
<P STYLE="font-weight: medium"><FONT COLOR="#000000"><FONT SIZE=3><I>These
application logic implementations are completely framework (i.e.
PocoCapsule/C++) independent (a.k.a container agnostic). They contain
no PocoCapsule/C++ specific code. It binary module (dynamic library),
after build, does not depend on (by linking to) PocoCapsule/C++
runtime either.</I></FONT></FONT></P>
<P><A HREF="sampleImpl.h">sampleImpl.h</A>: provides simple (inline)
implementation of all push-in ports (support SDR::PushPort) and the
log (support SDR::Log).</P>
<P><A HREF="sdr.h">sdr.h</A>: provides interface defintions of
SDR::PushPort, SDR::Controllable and SDR:Log.</P>
<P><A HREF="setup.xml">setup.xml:</A> This is the application context
described the setup of this SDR model application.</P>
<P><A HREF="sdr-device.dtd">sdr-device.dtd</A>: This is the document
type definition specifying the DSM schema. 
</P>
<P><A HREF="sdr-device2poco.xsl">sdr-device2poco.xsl</A>: This is the
DSM schema to the core schema of PocoCapsule/C++ transformation
stylesheet. 
</P>
<H3>Building this example</H3>
<P STYLE="font-weight: medium">To build this example, the environment
variable POCOCAPSULE_DIR should point to the PocoCapsule/C++
installed directory. Then, this example can be built by simply
invoking gmake/make on linux/unix or nmake on windows. 
</P>
<H3>Running this example</H3>
<P><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">Before
starting <FONT FACE="Times New Roman">the application deployment
container (i.e. the main executable)</FONT>, make sure the
LD_LIBRARY_PATH (on linux and solaris) or the PATH (on windows)
environment variable is set correctly to include the
${POCOCAPSULE_DIR}/lib directory.</FONT></P>
<P><FONT FACE="Symbol">&middot; </FONT><FONT FACE="Times New Roman">start
the main executable: </FONT>
</P>
<PRE STYLE="margin-left: 0.79in; margin-bottom: 0.2in"><FONT FACE="Courier 10 Pitch"><FONT SIZE=2 STYLE="font-size: 11pt"><B>prompt&gt;</B> main </FONT></FONT></PRE><P STYLE="margin-bottom: 0.2in">
<FONT FACE="Times New Roman">It will display the following component
instantiation and wiring operations made during the assembling:</FONT></P>
<PRE><FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The audio effect controller component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The node1 audio device component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The AudioIn push-in port of node1 audio device is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The AudioInRightDouble push-in port of the node1 audio device is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The AudioInLeftDouble push-in port of the node1 audio device is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The echo resource component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The AudioIn push-in port of the echo resource is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The chorus resource component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The AudioIn push-in port of the chorus resource is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The AudioIn push-in port of node1 audio device is connected to the AudioOut port of the chorus resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected the logPort of the chorus resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The AudioIn push-in port of the chorus resource is connected to the AudioOut port of the echo resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected the logPort of the echo resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The AudioIn push-in port of the echo resource is connected to the AudioOut port of the node1 audio device</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The demodulation FM resource component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The DoubleSeqIn push-in port of demodulation FM resource is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The AudioInRightDouble port of the node1 audio device is connected to the DoubleSeqOut port of the demodulation FM resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected to the logPort of the demodulation FM resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The DoubleSeqIn push-in port of demodulation FM resource is subscribed to the AudioOutLeftDouble port of the node1 audio device</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The modulation FM resource component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The DoubleSeqIn push-in port of modulation FM resource is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The AudioInLeftDouble push-in port of the node1 audio device is connected to the DoubleSeqOut port of the modulation FM resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected to the logPort of the modulation FM resource</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The DoubleSeqIn push-in port of modulation FM resource is subscribed to the AudioOutLeftDouble port of the node1 audio device</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected to the logPort of the node1 audio device</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The node1 audio device is connected to the AudioInControl port of the audio effect controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The node1 audio device is connected to the AudioOutControl port of the audio effect controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The echo resource is connected to the AudioEchoControl port of the audio effect controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The chorus resource is connected to the AudioChorusControl port of the audio effect controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected to the logPort of the audio effect controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt">[init]: The FM transmitter/receiver assembly controller component is instantiated</FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The modulation FM resource is connected to the ModulationFMControl port of the FM transmitter/receiver assembly controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The demodulation FM resource is connected to the DemodulationFMControl port of the FM transmitter/receiver assembly controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The node1 audio device is connected to the OutputDeviceControl port of the FM transmitter/receiver assembly controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The node1 audio device is connected to the InputDeviceControl port of the FM transmitter/receiver assembly controller</B></FONT></FONT>
<FONT FACE="Courier 10 Pitch"><FONT SIZE=1 STYLE="font-size: 8pt"><B>[wire]: The log service is connected to the logPort of the FM transmitter/receiver assembly controller</B></FONT></FONT></PRE><P STYLE="margin-bottom: 0.2in; font-weight: medium">
<FONT FACE="Times New Roman"><FONT SIZE=3>It shows 8
components/service, 7 push-in ports are instantiated, and 22
dependencies are wired.</FONT></FONT></P>
<P STYLE="margin-bottom: 0.2in"><A HREF="../../README.html"><FONT FACE="Times New Roman">Back
to the root page</FONT></A></P>
</BODY>
</HTML>
